package application.models.datalayer;

/**
 * A thin wrapper class for the Date class
 * Allows Date to be constructed from the output of its own toString() method
 * 
 * @author Philip Rasmussen & Morten Therkildsen
 */
public class Date extends java.util.Date {

	// Versioning token for the class. Required to make serialization work, which is inherited from java.util.Date
	private static final long serialVersionUID = 6501379530305002120L;

	/**
	 * Creates a date object representing the current time
	 */
	public Date(){
		
		super();
	}
	
	/**
	 * Creates a date object based on the java.util.Date class.
	 * @param An object of the java.util.Date class.
	 */
	public Date(java.util.Date date){
		
		this(date.getTime());
	}
	
	/**
	 * Overrides the method of the superclass java.util.Date
	 * @param Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
	 */
	public Date(long date){
		
		super(date);
	}
	
	/**
	 * Constructs a date object based on the java.util.Date class
	 * @param dateA string representation of the date
	 */
	public Date(String date){
		
		super(new Long(date));
	}
	
	/**
	 * Returns a string representation of the time in milliseconds since January 1, 1970, 00;00;00 GMT till the time of this date object
	 */
	public String toString(){
		
		return Long.toString(getTime());
	}
}